<?php

namespace App\Http\Controllers\Common;

use App\Components\FileUploader;
use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

class UploadController extends Controller
{
    public function upload(Request $request){
        if(!$request->hasFile('file')){
            throw new \Exception('图片未上传！');
        }
        $file = $request->file('file');

        $str_UploadName = time() . '_' . uniqid();
        $str_Path = FileUploader::upload($file, $str_UploadName, 'operation');
        return $this->output(1,'',[
            'src' => $str_Path
        ]);
    }
}
